﻿using System;
using System.Collections.Generic;
using System.Text;

namespace easysmb.Extra
{
    internal static class Helper
    {
        internal static long DateTimeMaxValue = DateTime.MaxValue.ToFileTimeUtc();
        internal const long DateTimeMinValue = 0;
        internal static DateTime ToFileTimeUtc(long datetime_long)
        {
            //解决System.ArgumentOutOfRangeException:“Not a valid Win32 FileTime. (Parameter 'fileTime')”
            if (datetime_long < DateTimeMinValue) datetime_long = DateTimeMinValue;
            else if (datetime_long > DateTimeMaxValue) datetime_long %= DateTimeMaxValue;
                
            return DateTime.FromFileTimeUtc(datetime_long);
        }
    }
}
